﻿#include "MainWidget.h"
#include "ui_MainWidget.h"

#include <QDebug>
#define DEBUG (qDebug().noquote() << QString(__FUNCTION__) + ":")

#ifdef Q_CC_MSVC
#pragma execution_character_set("utf-8")
#endif

#include "ObjectSelector.h"
#include "ObjectHierarchy.h"
#include "PropertyEditView.h"

MainWidget::~MainWidget() { }

MainWidget::MainWidget(QWidget *parent) : QWidget(parent) {
    ui.reset(new Ui::MainWidget);
    ui->setupUi(this);
}

void MainWidget::on_buttonInspectWidgets_clicked() {
    ObjectSelector::instance()->setEnabled(true);

    const auto hierarchy = new ObjectHierarchy(this);
    hierarchy->setWindowFlag(Qt::Window);
    hierarchy->show();

    const auto propertyEditor = new PropertyEditView(this);
    propertyEditor->setWindowFlag(Qt::Window);
    propertyEditor->show();

    connect(hierarchy, &ObjectHierarchy::currentObjectChanged, propertyEditor, &PropertyEditView::editObject);
}


